package com.example.administrator.nurse.present;

import android.content.Intent;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.administrator.nurse.R;
import com.example.administrator.nurse.base.BaseActivity;
import com.example.administrator.nurse.model.CommonViewHolder;
import com.example.administrator.nurse.model.bean.money_check_bean;
import com.example.administrator.nurse.util.recyclerViewHelper;
import com.jcodecraeer.xrecyclerview.XRecyclerView;

/**
 * Created by Administrator on 2016/5/2.
 *
 */

public class BodyCheckItemActivity extends BaseActivity {

    private recyclerViewHelper recyclerViewHelper;
    private Intent intent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        intent = getIntent();

        initView();
    }

    @Override
    protected int setLayotId() {
        return R.layout.body_check_item;
    }

    private void initView(){
        money_check_bean bean = (money_check_bean) intent.getSerializableExtra("data");
        configCommonHeader(BodyCheckItemActivity.this, bean.getName()+"的体检报告", 1);
        TextView name,sex,age,room,doc,hospital,area,bed;
        name = (TextView) f(R.id.name);
        sex = (TextView) f(R.id.sex);
        age = (TextView) f(R.id.age);
        room = (TextView) f(R.id.room);
        doc = (TextView) f(R.id.doc);
        hospital = (TextView) f(R.id.hospital);
        area = (TextView) f(R.id.area);
        bed = (TextView) f(R.id.bed);

        name.setText("姓名:"+bean.getName());
        sex.setText("性别:"+bean.getSex());
        age.setText("年龄:"+bean.getAge());
        room.setText("科室:"+bean.getRoom());
        doc.setText("医师:"+bean.getDoc());
        hospital.setText("住院号:"+bean.getHospital());
        area.setText("病房号:"+bean.getArea());
        bed.setText("住院号:"+bean.getBed());

        recyclerViewHelper = new recyclerViewHelper(this, (XRecyclerView) f(R.id.recyclerView))
                .withAdapter(R.layout.money_item_bean)
                /** 无测试的数据 */
                /*.withTestData(new recyclerViewHelper.TestDataInterface() {
                    @Override
                    public Object addTestData(int i) {
                        money_item_bean bean = new money_item_bean();
                        bean.setName("林冠宏");
                        bean.setMoney("233" + i);
                        bean.setNumber("" + (i + 1));
                        return bean;
                    }
                })*/
                .withBindView(new recyclerViewHelper.BindViewListener() {
                    @Override
                    public void bindView(CommonViewHolder holder, int position) {
                        TextView time, report;
                        LinearLayout container;
                        container = holder.getLinearLayout(R.id.container);
                        time = holder.getTextView(R.id.time);
                        report = holder.getTextView(R.id.report);

                        //time.setText(recyclerViewHelper.list.get(position).getName());
                        //number.setText(recyclerViewHelper.list.get(position).getNumber());
                        //money.setText(recyclerViewHelper.list.get(position).getMoney());
                    }
                })
                .withLoadMore(new recyclerViewHelper.loadMoreListener() {
                    @Override
                    public void loadMore() {

                    }
                })
                .initRecyclerView();
    }

    @Override
    protected void onFailure(int requestCode, Object object, String errorMsg) {

    }

    @Override
    protected void onSuccess(int requestCode, Object object, String response) {

    }

}
